package server

import (
	"github.com/gin-gonic/gin"

	"huaxrobot/controllers"
)

// NewRouter 路由配置
func NewRouter() *gin.Engine {
	r := gin.Default()
	// 路由
	v1 := r.Group("/api/v1")
	{
		v1.GET("/operation/plan/:planid", controllers.PlanGet)
		v1.GET("/operation/planlist", controllers.PlanGetList)
		v1.POST("/operation/plan", controllers.PlanAdd)
		v1.POST("/operation/planjenkins", controllers.PlanJenkinsAdd)
		v1.DELETE("/operation/plan/:planid", controllers.PlanDelete)

		v1.POST("/operation/performance", controllers.PerformanceAdd)
		v1.POST("/operation/performance/config", controllers.PerformanceConfigAdd)
		v1.GET("/operation/performance/configlist", controllers.PerformanceConfigListGet)

		v1.POST("/operation/planjenkinsbyname/:projectname", controllers.PlanJenkinsAddbyName)
		
		v1.POST("/inform/planresult", controllers.ToPlanResult)

		v1.GET("/statistics/recordlist", controllers.RecordListGet)
		v1.GET("/statistics/record", controllers.RecordGet)
	}
	return r
}